package com.it.demo.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.it.demo.entity.Permission;
import com.it.demo.entity.User;
import com.it.demo.mapper.UserMapper;
import com.it.demo.service.UserService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
@Slf4j
public class UserServiceImpl  extends ServiceImpl<UserMapper, User> implements UserService {

    @Override
    public User getByUsername(String username) {
        return baseMapper.selectOne(new LambdaQueryWrapper<User>().eq(User::getUserName,username));
    }

    @Override
    public List<Permission> findByUserRole(Integer id) {
        return baseMapper.findByUserRole(id);
    }


}
